var $ = require('../../utils/Ajax.js');
Page({
  data: {
    tabs: ["待完成", "已完成"],
    activeIndex: 0,
    MyOrder: null,
    MyOrder1: null
  },

  onLoad: function () {
    var that = this;
    wx.setNavigationBarTitle({
      title: "我的接单"
    })
  },

  onShow: function(){
    var that = this;
    $.Ajax("api/x_l_order", "POST", {}, function (res){
      console.log(res)
      that.setData({
        MyOrder: res.d.order_list,
        MyOrder1: res.d.order_list1
      })
    });
  },

  // 点击顶部tab栏
  tabClick: function (e) {
    this.setData({
      activeIndex: e.currentTarget.id
    });
  },

  callPhone: function (e) {
    var phone = e.currentTarget.dataset.ph;
    wx.makePhoneCall({
      phoneNumber: phone
    })
  }
});